package com.example.mapper;

import com.example.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {

    @Select("select * from user where account=#{account} and passwords=#{passwords}")
    User login(User user);

    @Insert("insert into user(account,passwords,user_type,number) values (#{account},#{passwords},#{userType},#{number})")
    void register(User user);

    @Select("select passwords from user where id=#{integer}")
    String getPasswords(Integer integer);

    @Update("update user set passwords=#{passwords} where id=#{id}")
    void setChangeMm(User user);

    @Select("select id,account,nickname,user_type,image,number from user where id=#{integer}")
    User getPim(Integer integer);

    void setPim(User user);

    @Insert("insert into user(passwords, nickname, user_type, number, account) values (#{passwords},#{nickname},#{userType}, #{number}, #{account})")
    void insert(User user);

    @Select("select account from user where account=#{account}")
    User getphone(String account);
}
